exe_by_fork: exe_by_fork.c
	gcc -o exe_by_fork exe_by_fork.c --static
	
seccomp2: seccomp2.c
	gcc -o seccomp2 seccomp2.c

seccomp: seccomp.c
	gcc -o seccomp seccomp.c

test: check-seccomp seccomp2 exe_by_fork 
	seccomp-tools dump ./seccomp2
	./seccomp2
all: test

.PHONY: check-seccomp all

check-seccomp:
	@if ! command -v seccomp-tools >/dev/null 2>&1; then \
		echo "Installing seccomp-tools via gem..."; \
		sudo gem install seccomp-tools || (echo "Installation failed, try manual install: sudo gem install seccomp-tools" && exit 1); \
	else \
		echo "seccomp-tools already installed"; \
	fi